package br.os.view;

import br.os.controller.OSController;

import com.sun.lwuit.Command;
import com.sun.lwuit.Container;
import com.sun.lwuit.Form;
import com.sun.lwuit.Label;
import com.sun.lwuit.TextField;
import com.sun.lwuit.layouts.BorderLayout;
import com.sun.lwuit.layouts.BoxLayout;

/**
 * OSAutenticacao
 * @author Rubean
 */
public class OSAutenticacao extends Form{
	private Command cmdSair   = new Command("Sair");
	private Command cmdEntrar = new Command("Entrar");
	private TextField tLogin;
	private TextField tSenha;
	private OSController controller;
	
	/**
	 * OSAutenticacao
	 */
	public OSAutenticacao(OSController controller) {
		super("Login");
		this.controller = controller;
		initComponents();
		show();
	}
	
	/**
	 * initComponents
	 */
	public void initComponents() {
		this.setLayout(new BorderLayout());
		Container center = new Container();
		center.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
		center.addComponent(new Label("Usuário"));
		tLogin = new TextField("admin");
		center.addComponent(tLogin);
		center.addComponent(new Label("Senha"));
		tSenha = new TextField("123");
		tSenha.setConstraint(TextField.PASSWORD);
		center.addComponent(tSenha);
		this.addComponent(BorderLayout.CENTER, center);
		this.addCommand(cmdSair);
		this.addCommand(cmdEntrar);
		this.addCommandListener(controller);
	}

	/**
	 * @return the cmdSair
	 */
	public Command getCmdSair() {
		return cmdSair;
	}

	/**
	 * @param cmdSair the cmdSair to set
	 */
	public void setCmdSair(Command cmdSair) {
		this.cmdSair = cmdSair;
	}

	/**
	 * @return the cmdEntrar
	 */
	public Command getCmdEntrar() {
		return cmdEntrar;
	}

	/**
	 * @param cmdEntrar the cmdEntrar to set
	 */
	public void setCmdEntrar(Command cmdEntrar) {
		this.cmdEntrar = cmdEntrar;
	}

	/**
	 * @return the tLogin
	 */
	public TextField gettLogin() {
		return tLogin;
	}

	/**
	 * @param tLogin the tLogin to set
	 */
	public void settLogin(TextField tLogin) {
		this.tLogin = tLogin;
	}

	/**
	 * @return the tSenha
	 */
	public TextField gettSenha() {
		return tSenha;
	}

	/**
	 * @param tSenha the tSenha to set
	 */
	public void settSenha(TextField tSenha) {
		this.tSenha = tSenha;
	}

	/**
	 * @return the controller
	 */
	public OSController getController() {
		return controller;
	}

	/**
	 * @param controller the controller to set
	 */
	public void setController(OSController controller) {
		this.controller = controller;
	}

}
